"""
生成器:生成器不同于生成式,它是动态计算的，从而可节省内存
"""

g = (x * x for x in range(10))
print(g)
while True:
    try:
        x = next(g)
        print(x)
    except StopIteration:
        break
for i in g:
    print(i)

